package org.example.slf4j.controller;


import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.context.annotation.Primary;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.PostConstruct;

@RestController
public class LoggerController {
    private static Logger logger =  LoggerFactory.getLogger(LoggerController.class);;
    @RequestMapping("/logger")
    public String logger() {
        logger.info("======我是日志======");
        return "日志打印成功！！！";
    }
    @PostConstruct
    public String printLog() {
        logger.trace("================= 我是trace ===============");
        logger.debug("================= 我是debug ===============");
        logger.info("================= 我是info ===============");
        logger.warn("================= 我是warn ===============");
        logger.error("================= 我是error ===============");
        return "打印不同级别的⽇志" ;
    }
}
